package com.yzd.learnjava.arrays;

import com.yzd.learnjava.util.CountingGenerator;
import com.yzd.learnjava.util.Generator;
import com.yzd.learnjava.util.Print;

public class GeneratorTest {
	public static int SIZE = 10;
	public static void test(Class<?> surroundingClass) {
		for(Class<?> type : surroundingClass.getClasses()) {
			Print.printnb(type.getSimpleName() + ": ");
			try {
				Generator<?> g = (Generator<?>)type.newInstance();
				for(int i = 0 ; i < SIZE; i++) {
					Print.printnb(g.next() + " ");
				}
				Print.print();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String[] args) {
		test(CountingGenerator.class);
	}
}
